<template>
  <div class="table_container">
    <el-table
      ref="tableNode"
      v-loading="isLoading"
      :height="tableMaxHeight"
      :data="tableData"
      @current-change="handleCurrentChange"
      highlight-current-row
      border
      tooltip-effect="dark">
      <el-table-column label="" width="40" align="center">
        <template slot-scope="scope">
          <el-radio class="radio_no_label" :label="scope.row.id" v-model="radio"></el-radio>
        </template>
      </el-table-column>
      <el-table-column
        prop="sort"
        label="工序序号"
        align="center"
        min-width="80">
      </el-table-column>
      <el-table-column
        prop="workstageName"
        label="工序名称"
        show-overflow-tooltip
        :resizable="false"
        min-width="140">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'CompareStageTable',
  data() {
    return {
      isLoading: false,
      tableData: [], // 工序列表
      currentRow: {}, // 当前工序
      radio: ''
    }
  },
  methods: {
    handleCurrentChange(row) {
      if (row === null) return
      this.currentRow = row
      this.radio = row.id
      this.$emit('change', row)
    },
    init(list = []) {
      this.tableData = list
      this.$refs.tableNode.setCurrentRow(list[0])
      this.radio = list[0].id
      this.$emit('change', list[0])
    }
  }
}
</script>

<style lang="less" scoped>

</style>
